package driver.handlers;

import state.group.events.BaseEvent;
import state.person.Person;

public abstract class BasePersonTypeHandler {
    
    public void handleEvent(BaseEvent message, Person p)
    {
        switch (p.getState())
        {
            case waiting:
                handleWaiting(message, p);
                break;
            case goingIn:
                handleGoingIn(message, p);
                break;
            case inside:
                handleInside(message, p);
                break;
            case goingOut:
                handleGoingOut(message, p);
                break;
            case atDestination:
                handleDestination(message, p);
                break;
            default:
                throw new RuntimeException("Received an unrecognized state: " + p.getState());
        }
    }
    
    public abstract void handleCreation(Person p);

    protected abstract void handleDestination(BaseEvent message, Person p);

    protected abstract void handleGoingOut(BaseEvent message, Person p);

    protected abstract void handleInside(BaseEvent message, Person p);

    protected abstract void handleGoingIn(BaseEvent message, Person p);

    protected abstract void handleWaiting(BaseEvent message, Person p);
    
}
